import json

import scrapy


class AnjvkSjSpider(scrapy.Spider):
    name = 'anjvk_sj'
    allowed_domains = ['anjuke.com']
    start_urls = ['https://shuyang.anjuke.com/v3/ajax/map/sale/2310/prop_list/?p=1']

    def parse(self, response):
        # print(type(response.text))
        val = json.loads(response.text).get('val')
        print('______________________________________________>', type(val))
        yield val
        self.num = 2
        while self.num <= 10:
            url = 'https://shuyang.anjuke.com/v3/ajax/map/sale/2310/prop_list/?p={}'.format(self.num)
            self.num += 1

            yield scrapy.Request(url=url, callback=self.parse)
